package application.common.util;

import java.util.List;

import com.jfinal.kit.StrKit;

import application.Main;
import application.common.model.CameraRecord;
import application.common.model.Config;
import application.common.model.User;
import application.common.render.NET_DVR_DEVICE;

public class ShiroUtil {
	
	private static Config config;

	public static Config getConfig() {
		return config;
	}

	public static void setConfig(Config config) {
		ShiroUtil.config = config;
	}
	
	private static User user;
	public static User getUser() {
		return user;
	}
	public static void setUser(User user) {
		ShiroUtil.user = user;
	}

	private static List<NET_DVR_DEVICE> cameras;
	
	public static List<NET_DVR_DEVICE> getCameras() {
		return cameras;
	}

	public static void setCameras(List<NET_DVR_DEVICE> cameras) {
		ShiroUtil.cameras = cameras;
	}
	
	public static String getSoftName() {
		if(config!=null && !StrKit.isBlank(config.getName())) {
			return config.getName();
		}
		return "智能卷宗柜";
	}
	
	public static String getCopyright() {
		if(config!=null && !StrKit.isBlank(config.getCopyright())) {
			return config.getCopyright();
		}
		return "云南赢中集团科技有限公司研制";
	}
	
	public static String getPhone() {
		if(config!=null && !StrKit.isBlank(config.getPhone())) {
			return config.getPhone();
		}
		return "0000-0000000";
	}
	
	public static boolean isDevMode() {
		if(config!=null ) {
			if(StrKit.equals("1", config.getDevMode())) {
				return true;
			}
		}
		return false;
	}
	
	public static String getAuth() {
		if(config!=null) {
			return config.getId();
		}
		return "";
	}
	
	public static int getTimeout() {
		try {
			if(config!=null) {
				int timeout= Integer.parseInt(config.getTimeout());
				return timeout>0?timeout:60;
			}
			return 60;
		}catch (Exception e) {
		}
		return 60;
	}
	
	public static int getCabinetTimeout() {
		if(config!=null ) {
			return config.getCabinetTimeout()!=0?config.getCabinetTimeout():20;
		}
		return 20;
	}
	
	
//	private static List<StoreMap>  storeMaps;
//	public static List<StoreMap> getStoreMaps() {
//		return storeMaps;
//	}
//
//	public static void setStoreMaps(List<StoreMap> storeMaps) {
//		ShiroUtil.storeMaps = storeMaps;
//	}
	
//	private static Map<String,NET_DVR_DEVICE> DVR_DEVICE_MAP;
//
//	public static Map<String, NET_DVR_DEVICE> getDVR_DEVICE_MAP() {
//		return DVR_DEVICE_MAP;
//	}
//
//	public static void setDVR_DEVICE_MAP(Map<String, NET_DVR_DEVICE> dVR_DEVICE_MAP) {
//		DVR_DEVICE_MAP = dVR_DEVICE_MAP;
//	}
//	
	private static Main mainProcess;

	public static Main getMainProcess() {
		return mainProcess;
	}

	public static void setMainProcess(Main mainProcess) {
		ShiroUtil.mainProcess = mainProcess;
	}
	
	private static CameraRecord cameraRecord;

	public static CameraRecord getCameraRecord() {
		return cameraRecord;
	}

	public static void setCameraRecord(CameraRecord cameraRecord) {
		ShiroUtil.cameraRecord = cameraRecord;
	}
	
	private static int processId;

	public static int getProcessId() {
		return processId;
	}

	public static void setProcessId(int processId) {
		ShiroUtil.processId = processId;
	}
	
	
	
	
}
